3.13.2 \(\int \frac {(c+d \tan (e+f x))^2}{(a+b \tan (e+f x))^3} \, dx\) [1202]

3.13.2.1 Optimal result
3.13.2.2 Mathematica [C] (verified)
3.13.2.3 Rubi [A] (verified)
3.13.2.4 Maple [A] (verified)
3.13.2.5 Fricas [B] (verification not implemented)
3.13.2.6 Sympy [F(-2)]
3.13.2.7 Maxima [B] (verification not implemented)
3.13.2.8 Giac [B] (verification not implemented)
3.13.2.9 Mupad [B] (verification not implemented)

3.13.2.1 Optimal result

Integrand size = 25, antiderivative size = 214 \[ \int \frac {(c+d \tan (e+f x))^2}{(a+b \tan (e+f x))^3} \, dx=\frac {\left (6 a^2 b c d-2 b^3 c d+a^3 \left (c^2-d^2\right )-3 a b^2 \left (c^2-d^2\right )\right ) x}{\left (a^2+b^2\right )^3}-\frac {\left (2 a^3 c d-6 a b^2 c d-3 a^2 b \left (c^2-d^2\right )+b^3 \left (c^2-d^2\right )\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{\left (a^2+b^2\right )^3 f}-\frac {(b c-a d)^2}{2 b \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {2 (b c-a d) (a c+b d)}{\left (a^2+b^2\right )^2 f (a+b \tan (e+f x))} \]

output
(6*a^2*b*c*d-2*b^3*c*d+a^3*(c^2-d^2)-3*a*b^2*(c^2-d^2))*x/(a^2+b^2)^3-(2*a 
^3*c*d-6*a*b^2*c*d-3*a^2*b*(c^2-d^2)+b^3*(c^2-d^2))*ln(a*cos(f*x+e)+b*sin( 
f*x+e))/(a^2+b^2)^3/f-1/2*(-a*d+b*c)^2/b/(a^2+b^2)/f/(a+b*tan(f*x+e))^2-2* 
(-a*d+b*c)*(a*c+b*d)/(a^2+b^2)^2/f/(a+b*tan(f*x+e))
 
3.13.2.2 Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 3.86 (sec) , antiderivative size = 291, normalized size of antiderivative = 1.36 \[ \int \frac {(c+d \tan (e+f x))^2}{(a+b \tan (e+f x))^3} \, dx=\frac {\frac {b d (c+d \tan (e+f x))^2}{a+b \tan (e+f x)}-\frac {b^2 (c+d \tan (e+f x))^3}{(a+b \tan (e+f x))^2}+(b c-a d) \left (\frac {(i a+b)^3 (c+i d)^2 \log (i-\tan (e+f x))}{\left (a^2+b^2\right )^2}+\frac {i (a+i b) (c-i d)^2 \log (i+\tan (e+f x))}{(a-i b)^2}-\frac {2 \left (2 a^3 c d-6 a b^2 c d+b^3 \left (c^2-d^2\right )+3 a^2 b \left (-c^2+d^2\right )\right ) \log (a+b \tan (e+f x))}{\left (a^2+b^2\right )^2}-\frac {2 (b c-a d) \left (2 a b c-a^2 d+b^2 d\right )}{b \left (a^2+b^2\right ) (a+b \tan (e+f x))}\right )}{2 \left (a^2+b^2\right ) (b c-a d) f} \]

input
Integrate[(c + d*Tan[e + f*x])^2/(a + b*Tan[e + f*x])^3,x]
 
output
((b*d*(c + d*Tan[e + f*x])^2)/(a + b*Tan[e + f*x]) - (b^2*(c + d*Tan[e + f 
*x])^3)/(a + b*Tan[e + f*x])^2 + (b*c - a*d)*(((I*a + b)^3*(c + I*d)^2*Log 
[I - Tan[e + f*x]])/(a^2 + b^2)^2 + (I*(a + I*b)*(c - I*d)^2*Log[I + Tan[e 
 + f*x]])/(a - I*b)^2 - (2*(2*a^3*c*d - 6*a*b^2*c*d + b^3*(c^2 - d^2) + 3* 
a^2*b*(-c^2 + d^2))*Log[a + b*Tan[e + f*x]])/(a^2 + b^2)^2 - (2*(b*c - a*d 
)*(2*a*b*c - a^2*d + b^2*d))/(b*(a^2 + b^2)*(a + b*Tan[e + f*x]))))/(2*(a^ 
2 + b^2)*(b*c - a*d)*f)
 
3.13.2.3 Rubi [A] (verified)

Time = 0.99 (sec) , antiderivative size = 237, normalized size of antiderivative = 1.11, number of steps used = 9, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.360, Rules used = {3042, 4025, 3042, 4012, 25, 3042, 4014, 3042, 4013}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {(c+d \tan (e+f x))^2}{(a+b \tan (e+f x))^3} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(c+d \tan (e+f x))^2}{(a+b \tan (e+f x))^3}dx\)

\(\Big \downarrow \) 4025

\(\displaystyle \frac {\int \frac {2 b c d+a \left (c^2-d^2\right )+\left (2 a c d-b \left (c^2-d^2\right )\right ) \tan (e+f x)}{(a+b \tan (e+f x))^2}dx}{a^2+b^2}-\frac {(b c-a d)^2}{2 b f \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \frac {2 b c d+a \left (c^2-d^2\right )+\left (2 a c d-b \left (c^2-d^2\right )\right ) \tan (e+f x)}{(a+b \tan (e+f x))^2}dx}{a^2+b^2}-\frac {(b c-a d)^2}{2 b f \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}\)

\(\Big \downarrow \) 4012

\(\displaystyle \frac {\frac {\int -\frac {(b (c-d)-a (c+d)) (a (c-d)+b (c+d))+2 (b c-a d) (a c+b d) \tan (e+f x)}{a+b \tan (e+f x)}dx}{a^2+b^2}-\frac {2 (b c-a d) (a c+b d)}{f \left (a^2+b^2\right ) (a+b \tan (e+f x))}}{a^2+b^2}-\frac {(b c-a d)^2}{2 b f \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {-\frac {\int \frac {(b (c-d)-a (c+d)) (a (c-d)+b (c+d))+2 (b c-a d) (a c+b d) \tan (e+f x)}{a+b \tan (e+f x)}dx}{a^2+b^2}-\frac {2 (b c-a d) (a c+b d)}{f \left (a^2+b^2\right ) (a+b \tan (e+f x))}}{a^2+b^2}-\frac {(b c-a d)^2}{2 b f \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {-\frac {\int \frac {(b (c-d)-a (c+d)) (a (c-d)+b (c+d))+2 (b c-a d) (a c+b d) \tan (e+f x)}{a+b \tan (e+f x)}dx}{a^2+b^2}-\frac {2 (b c-a d) (a c+b d)}{f \left (a^2+b^2\right ) (a+b \tan (e+f x))}}{a^2+b^2}-\frac {(b c-a d)^2}{2 b f \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}\)

\(\Big \downarrow \) 4014

\(\displaystyle \frac {-\frac {\frac {\left (2 a^3 c d-3 a^2 b \left (c^2-d^2\right )-6 a b^2 c d+b^3 \left (c^2-d^2\right )\right ) \int \frac {b-a \tan (e+f x)}{a+b \tan (e+f x)}dx}{a^2+b^2}-\frac {x \left (a^3 \left (c^2-d^2\right )+6 a^2 b c d-3 a b^2 \left (c^2-d^2\right )-2 b^3 c d\right )}{a^2+b^2}}{a^2+b^2}-\frac {2 (b c-a d) (a c+b d)}{f \left (a^2+b^2\right ) (a+b \tan (e+f x))}}{a^2+b^2}-\frac {(b c-a d)^2}{2 b f \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {-\frac {\frac {\left (2 a^3 c d-3 a^2 b \left (c^2-d^2\right )-6 a b^2 c d+b^3 \left (c^2-d^2\right )\right ) \int \frac {b-a \tan (e+f x)}{a+b \tan (e+f x)}dx}{a^2+b^2}-\frac {x \left (a^3 \left (c^2-d^2\right )+6 a^2 b c d-3 a b^2 \left (c^2-d^2\right )-2 b^3 c d\right )}{a^2+b^2}}{a^2+b^2}-\frac {2 (b c-a d) (a c+b d)}{f \left (a^2+b^2\right ) (a+b \tan (e+f x))}}{a^2+b^2}-\frac {(b c-a d)^2}{2 b f \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}\)

\(\Big \downarrow \) 4013

\(\displaystyle \frac {-\frac {2 (b c-a d) (a c+b d)}{f \left (a^2+b^2\right ) (a+b \tan (e+f x))}-\frac {\frac {\left (2 a^3 c d-3 a^2 b \left (c^2-d^2\right )-6 a b^2 c d+b^3 \left (c^2-d^2\right )\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right )}-\frac {x \left (a^3 \left (c^2-d^2\right )+6 a^2 b c d-3 a b^2 \left (c^2-d^2\right )-2 b^3 c d\right )}{a^2+b^2}}{a^2+b^2}}{a^2+b^2}-\frac {(b c-a d)^2}{2 b f \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}\)

input
Int[(c + d*Tan[e + f*x])^2/(a + b*Tan[e + f*x])^3,x]
 
output
-1/2*(b*c - a*d)^2/(b*(a^2 + b^2)*f*(a + b*Tan[e + f*x])^2) + (-((-(((6*a^ 
2*b*c*d - 2*b^3*c*d + a^3*(c^2 - d^2) - 3*a*b^2*(c^2 - d^2))*x)/(a^2 + b^2 
)) + ((2*a^3*c*d - 6*a*b^2*c*d - 3*a^2*b*(c^2 - d^2) + b^3*(c^2 - d^2))*Lo 
g[a*Cos[e + f*x] + b*Sin[e + f*x]])/((a^2 + b^2)*f))/(a^2 + b^2)) - (2*(b* 
c - a*d)*(a*c + b*d))/((a^2 + b^2)*f*(a + b*Tan[e + f*x])))/(a^2 + b^2)
 

3.13.2.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4012
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)]), x_Symbol] :> Simp[(b*c - a*d)*((a + b*Tan[e + f*x])^(m + 1)/ 
(f*(m + 1)*(a^2 + b^2))), x] + Simp[1/(a^2 + b^2)   Int[(a + b*Tan[e + f*x] 
)^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a 
, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1 
]
 

rule 4013
Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)* 
(x_)]), x_Symbol] :> Simp[(c/(b*f))*Log[RemoveContent[a*Cos[e + f*x] + b*Si 
n[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && 
 NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]
 

rule 4014
Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_. 
)*(x_)]), x_Symbol] :> Simp[(a*c + b*d)*(x/(a^2 + b^2)), x] + Simp[(b*c - a 
*d)/(a^2 + b^2)   Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x] /; 
FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && N 
eQ[a*c + b*d, 0]
 

rule 4025
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^2, x_Symbol] :> Simp[(b*c - a*d)^2*((a + b*Tan[e + f*x])^(m + 
 1)/(b*f*(m + 1)*(a^2 + b^2))), x] + Simp[1/(a^2 + b^2)   Int[(a + b*Tan[e 
+ f*x])^(m + 1)*Simp[a*c^2 + 2*b*c*d - a*d^2 - (b*c^2 - 2*a*c*d - b*d^2)*Ta 
n[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] 
 && LtQ[m, -1] && NeQ[a^2 + b^2, 0]
 
3.13.2.4 Maple [A] (verified)

Time = 0.40 (sec) , antiderivative size = 304, normalized size of antiderivative = 1.42

method result size
derivativedivides \(\frac {\frac {\frac {\left (2 a^{3} c d -3 a^{2} b \,c^{2}+3 a^{2} b \,d^{2}-6 a \,b^{2} c d +b^{3} c^{2}-b^{3} d^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{3} c^{2}-a^{3} d^{2}+6 a^{2} b c d -3 a \,b^{2} c^{2}+3 a \,b^{2} d^{2}-2 b^{3} c d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}-\frac {a^{2} d^{2}-2 a b c d +b^{2} c^{2}}{2 \left (a^{2}+b^{2}\right ) b \left (a +b \tan \left (f x +e \right )\right )^{2}}+\frac {2 a^{2} c d -2 a b \,c^{2}+2 a b \,d^{2}-2 b^{2} c d}{\left (a^{2}+b^{2}\right )^{2} \left (a +b \tan \left (f x +e \right )\right )}-\frac {\left (2 a^{3} c d -3 a^{2} b \,c^{2}+3 a^{2} b \,d^{2}-6 a \,b^{2} c d +b^{3} c^{2}-b^{3} d^{2}\right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}}{f}\) \(304\)
default \(\frac {\frac {\frac {\left (2 a^{3} c d -3 a^{2} b \,c^{2}+3 a^{2} b \,d^{2}-6 a \,b^{2} c d +b^{3} c^{2}-b^{3} d^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{3} c^{2}-a^{3} d^{2}+6 a^{2} b c d -3 a \,b^{2} c^{2}+3 a \,b^{2} d^{2}-2 b^{3} c d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}-\frac {a^{2} d^{2}-2 a b c d +b^{2} c^{2}}{2 \left (a^{2}+b^{2}\right ) b \left (a +b \tan \left (f x +e \right )\right )^{2}}+\frac {2 a^{2} c d -2 a b \,c^{2}+2 a b \,d^{2}-2 b^{2} c d}{\left (a^{2}+b^{2}\right )^{2} \left (a +b \tan \left (f x +e \right )\right )}-\frac {\left (2 a^{3} c d -3 a^{2} b \,c^{2}+3 a^{2} b \,d^{2}-6 a \,b^{2} c d +b^{3} c^{2}-b^{3} d^{2}\right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}}{f}\) \(304\)
norman \(\frac {\frac {\left (a^{3} c^{2}-a^{3} d^{2}+6 a^{2} b c d -3 a \,b^{2} c^{2}+3 a \,b^{2} d^{2}-2 b^{3} c d \right ) a^{2} x}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (a^{2}+b^{2}\right )}+\frac {b^{2} \left (a^{3} c^{2}-a^{3} d^{2}+6 a^{2} b c d -3 a \,b^{2} c^{2}+3 a \,b^{2} d^{2}-2 b^{3} c d \right ) x \left (\tan ^{2}\left (f x +e \right )\right )}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (a^{2}+b^{2}\right )}+\frac {-a^{4} b \,d^{2}+6 a^{3} b^{2} c d -5 a^{2} b^{3} c^{2}+3 a^{2} b^{3} d^{2}-2 a \,b^{4} c d -b^{5} c^{2}}{2 f \,b^{2} \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {2 \left (a^{2} b^{2} c d -a \,b^{3} c^{2}+a \,b^{3} d^{2}-b^{4} c d \right ) \tan \left (f x +e \right )}{f b \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {2 b \left (a^{3} c^{2}-a^{3} d^{2}+6 a^{2} b c d -3 a \,b^{2} c^{2}+3 a \,b^{2} d^{2}-2 b^{3} c d \right ) a x \tan \left (f x +e \right )}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (a^{2}+b^{2}\right )}}{\left (a +b \tan \left (f x +e \right )\right )^{2}}+\frac {\left (2 a^{3} c d -3 a^{2} b \,c^{2}+3 a^{2} b \,d^{2}-6 a \,b^{2} c d +b^{3} c^{2}-b^{3} d^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}-\frac {\left (2 a^{3} c d -3 a^{2} b \,c^{2}+3 a^{2} b \,d^{2}-6 a \,b^{2} c d +b^{3} c^{2}-b^{3} d^{2}\right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{f \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}\) \(598\)
risch \(\text {Expression too large to display}\) \(1243\)
parallelrisch \(\text {Expression too large to display}\) \(1462\)

input
int((c+d*tan(f*x+e))^2/(a+b*tan(f*x+e))^3,x,method=_RETURNVERBOSE)
 
output
1/f*(1/(a^2+b^2)^3*(1/2*(2*a^3*c*d-3*a^2*b*c^2+3*a^2*b*d^2-6*a*b^2*c*d+b^3 
*c^2-b^3*d^2)*ln(1+tan(f*x+e)^2)+(a^3*c^2-a^3*d^2+6*a^2*b*c*d-3*a*b^2*c^2+ 
3*a*b^2*d^2-2*b^3*c*d)*arctan(tan(f*x+e)))-1/2*(a^2*d^2-2*a*b*c*d+b^2*c^2) 
/(a^2+b^2)/b/(a+b*tan(f*x+e))^2+2*(a^2*c*d-a*b*c^2+a*b*d^2-b^2*c*d)/(a^2+b 
^2)^2/(a+b*tan(f*x+e))-(2*a^3*c*d-3*a^2*b*c^2+3*a^2*b*d^2-6*a*b^2*c*d+b^3* 
c^2-b^3*d^2)/(a^2+b^2)^3*ln(a+b*tan(f*x+e)))
 
3.13.2.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 706 vs. \(2 (212) = 424\).

Time = 0.26 (sec) , antiderivative size = 706, normalized size of antiderivative = 3.30 \[ \int \frac {(c+d \tan (e+f x))^2}{(a+b \tan (e+f x))^3} \, dx=-\frac {{\left (7 \, a^{2} b^{3} + b^{5}\right )} c^{2} - 2 \, {\left (5 \, a^{3} b^{2} - a b^{4}\right )} c d + 3 \, {\left (a^{4} b - a^{2} b^{3}\right )} d^{2} - 2 \, {\left ({\left (a^{5} - 3 \, a^{3} b^{2}\right )} c^{2} + 2 \, {\left (3 \, a^{4} b - a^{2} b^{3}\right )} c d - {\left (a^{5} - 3 \, a^{3} b^{2}\right )} d^{2}\right )} f x - {\left ({\left (5 \, a^{2} b^{3} - b^{5}\right )} c^{2} - 6 \, {\left (a^{3} b^{2} - a b^{4}\right )} c d + {\left (a^{4} b - 5 \, a^{2} b^{3}\right )} d^{2} + 2 \, {\left ({\left (a^{3} b^{2} - 3 \, a b^{4}\right )} c^{2} + 2 \, {\left (3 \, a^{2} b^{3} - b^{5}\right )} c d - {\left (a^{3} b^{2} - 3 \, a b^{4}\right )} d^{2}\right )} f x\right )} \tan \left (f x + e\right )^{2} - {\left ({\left (3 \, a^{4} b - a^{2} b^{3}\right )} c^{2} - 2 \, {\left (a^{5} - 3 \, a^{3} b^{2}\right )} c d - {\left (3 \, a^{4} b - a^{2} b^{3}\right )} d^{2} + {\left ({\left (3 \, a^{2} b^{3} - b^{5}\right )} c^{2} - 2 \, {\left (a^{3} b^{2} - 3 \, a b^{4}\right )} c d - {\left (3 \, a^{2} b^{3} - b^{5}\right )} d^{2}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left ({\left (3 \, a^{3} b^{2} - a b^{4}\right )} c^{2} - 2 \, {\left (a^{4} b - 3 \, a^{2} b^{3}\right )} c d - {\left (3 \, a^{3} b^{2} - a b^{4}\right )} d^{2}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {b^{2} \tan \left (f x + e\right )^{2} + 2 \, a b \tan \left (f x + e\right ) + a^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - 2 \, {\left (3 \, {\left (a^{3} b^{2} - a b^{4}\right )} c^{2} - 2 \, {\left (2 \, a^{4} b - 3 \, a^{2} b^{3} + b^{5}\right )} c d + {\left (a^{5} - 3 \, a^{3} b^{2} + 2 \, a b^{4}\right )} d^{2} + 2 \, {\left ({\left (a^{4} b - 3 \, a^{2} b^{3}\right )} c^{2} + 2 \, {\left (3 \, a^{3} b^{2} - a b^{4}\right )} c d - {\left (a^{4} b - 3 \, a^{2} b^{3}\right )} d^{2}\right )} f x\right )} \tan \left (f x + e\right )}{2 \, {\left ({\left (a^{6} b^{2} + 3 \, a^{4} b^{4} + 3 \, a^{2} b^{6} + b^{8}\right )} f \tan \left (f x + e\right )^{2} + 2 \, {\left (a^{7} b + 3 \, a^{5} b^{3} + 3 \, a^{3} b^{5} + a b^{7}\right )} f \tan \left (f x + e\right ) + {\left (a^{8} + 3 \, a^{6} b^{2} + 3 \, a^{4} b^{4} + a^{2} b^{6}\right )} f\right )}} \]

input
integrate((c+d*tan(f*x+e))^2/(a+b*tan(f*x+e))^3,x, algorithm="fricas")
 
output
-1/2*((7*a^2*b^3 + b^5)*c^2 - 2*(5*a^3*b^2 - a*b^4)*c*d + 3*(a^4*b - a^2*b 
^3)*d^2 - 2*((a^5 - 3*a^3*b^2)*c^2 + 2*(3*a^4*b - a^2*b^3)*c*d - (a^5 - 3* 
a^3*b^2)*d^2)*f*x - ((5*a^2*b^3 - b^5)*c^2 - 6*(a^3*b^2 - a*b^4)*c*d + (a^ 
4*b - 5*a^2*b^3)*d^2 + 2*((a^3*b^2 - 3*a*b^4)*c^2 + 2*(3*a^2*b^3 - b^5)*c* 
d - (a^3*b^2 - 3*a*b^4)*d^2)*f*x)*tan(f*x + e)^2 - ((3*a^4*b - a^2*b^3)*c^ 
2 - 2*(a^5 - 3*a^3*b^2)*c*d - (3*a^4*b - a^2*b^3)*d^2 + ((3*a^2*b^3 - b^5) 
*c^2 - 2*(a^3*b^2 - 3*a*b^4)*c*d - (3*a^2*b^3 - b^5)*d^2)*tan(f*x + e)^2 + 
 2*((3*a^3*b^2 - a*b^4)*c^2 - 2*(a^4*b - 3*a^2*b^3)*c*d - (3*a^3*b^2 - a*b 
^4)*d^2)*tan(f*x + e))*log((b^2*tan(f*x + e)^2 + 2*a*b*tan(f*x + e) + a^2) 
/(tan(f*x + e)^2 + 1)) - 2*(3*(a^3*b^2 - a*b^4)*c^2 - 2*(2*a^4*b - 3*a^2*b 
^3 + b^5)*c*d + (a^5 - 3*a^3*b^2 + 2*a*b^4)*d^2 + 2*((a^4*b - 3*a^2*b^3)*c 
^2 + 2*(3*a^3*b^2 - a*b^4)*c*d - (a^4*b - 3*a^2*b^3)*d^2)*f*x)*tan(f*x + e 
))/((a^6*b^2 + 3*a^4*b^4 + 3*a^2*b^6 + b^8)*f*tan(f*x + e)^2 + 2*(a^7*b + 
3*a^5*b^3 + 3*a^3*b^5 + a*b^7)*f*tan(f*x + e) + (a^8 + 3*a^6*b^2 + 3*a^4*b 
^4 + a^2*b^6)*f)
 
3.13.2.6 Sympy [F(-2)]

Exception generated. \[ \int \frac {(c+d \tan (e+f x))^2}{(a+b \tan (e+f x))^3} \, dx=\text {Exception raised: AttributeError} \]

input
integrate((c+d*tan(f*x+e))**2/(a+b*tan(f*x+e))**3,x)
 
output
Exception raised: AttributeError >> 'NoneType' object has no attribute 'pr 
imitive'
 
3.13.2.7 Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 431 vs. \(2 (212) = 424\).

Time = 0.36 (sec) , antiderivative size = 431, normalized size of antiderivative = 2.01 \[ \int \frac {(c+d \tan (e+f x))^2}{(a+b \tan (e+f x))^3} \, dx=\frac {\frac {2 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c^{2} + 2 \, {\left (3 \, a^{2} b - b^{3}\right )} c d - {\left (a^{3} - 3 \, a b^{2}\right )} d^{2}\right )} {\left (f x + e\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {2 \, {\left ({\left (3 \, a^{2} b - b^{3}\right )} c^{2} - 2 \, {\left (a^{3} - 3 \, a b^{2}\right )} c d - {\left (3 \, a^{2} b - b^{3}\right )} d^{2}\right )} \log \left (b \tan \left (f x + e\right ) + a\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {{\left ({\left (3 \, a^{2} b - b^{3}\right )} c^{2} - 2 \, {\left (a^{3} - 3 \, a b^{2}\right )} c d - {\left (3 \, a^{2} b - b^{3}\right )} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {{\left (5 \, a^{2} b^{2} + b^{4}\right )} c^{2} - 2 \, {\left (3 \, a^{3} b - a b^{3}\right )} c d + {\left (a^{4} - 3 \, a^{2} b^{2}\right )} d^{2} + 4 \, {\left (a b^{3} c^{2} - a b^{3} d^{2} - {\left (a^{2} b^{2} - b^{4}\right )} c d\right )} \tan \left (f x + e\right )}{a^{6} b + 2 \, a^{4} b^{3} + a^{2} b^{5} + {\left (a^{4} b^{3} + 2 \, a^{2} b^{5} + b^{7}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left (a^{5} b^{2} + 2 \, a^{3} b^{4} + a b^{6}\right )} \tan \left (f x + e\right )}}{2 \, f} \]

input
integrate((c+d*tan(f*x+e))^2/(a+b*tan(f*x+e))^3,x, algorithm="maxima")
 
output
1/2*(2*((a^3 - 3*a*b^2)*c^2 + 2*(3*a^2*b - b^3)*c*d - (a^3 - 3*a*b^2)*d^2) 
*(f*x + e)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) + 2*((3*a^2*b - b^3)*c^2 - 
2*(a^3 - 3*a*b^2)*c*d - (3*a^2*b - b^3)*d^2)*log(b*tan(f*x + e) + a)/(a^6 
+ 3*a^4*b^2 + 3*a^2*b^4 + b^6) - ((3*a^2*b - b^3)*c^2 - 2*(a^3 - 3*a*b^2)* 
c*d - (3*a^2*b - b^3)*d^2)*log(tan(f*x + e)^2 + 1)/(a^6 + 3*a^4*b^2 + 3*a^ 
2*b^4 + b^6) - ((5*a^2*b^2 + b^4)*c^2 - 2*(3*a^3*b - a*b^3)*c*d + (a^4 - 3 
*a^2*b^2)*d^2 + 4*(a*b^3*c^2 - a*b^3*d^2 - (a^2*b^2 - b^4)*c*d)*tan(f*x + 
e))/(a^6*b + 2*a^4*b^3 + a^2*b^5 + (a^4*b^3 + 2*a^2*b^5 + b^7)*tan(f*x + e 
)^2 + 2*(a^5*b^2 + 2*a^3*b^4 + a*b^6)*tan(f*x + e)))/f
 
3.13.2.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 597 vs. \(2 (212) = 424\).

Time = 0.65 (sec) , antiderivative size = 597, normalized size of antiderivative = 2.79 \[ \int \frac {(c+d \tan (e+f x))^2}{(a+b \tan (e+f x))^3} \, dx=\frac {\frac {2 \, {\left (a^{3} c^{2} - 3 \, a b^{2} c^{2} + 6 \, a^{2} b c d - 2 \, b^{3} c d - a^{3} d^{2} + 3 \, a b^{2} d^{2}\right )} {\left (f x + e\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {{\left (3 \, a^{2} b c^{2} - b^{3} c^{2} - 2 \, a^{3} c d + 6 \, a b^{2} c d - 3 \, a^{2} b d^{2} + b^{3} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {2 \, {\left (3 \, a^{2} b^{2} c^{2} - b^{4} c^{2} - 2 \, a^{3} b c d + 6 \, a b^{3} c d - 3 \, a^{2} b^{2} d^{2} + b^{4} d^{2}\right )} \log \left ({\left | b \tan \left (f x + e\right ) + a \right |}\right )}{a^{6} b + 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} + b^{7}} - \frac {9 \, a^{2} b^{4} c^{2} \tan \left (f x + e\right )^{2} - 3 \, b^{6} c^{2} \tan \left (f x + e\right )^{2} - 6 \, a^{3} b^{3} c d \tan \left (f x + e\right )^{2} + 18 \, a b^{5} c d \tan \left (f x + e\right )^{2} - 9 \, a^{2} b^{4} d^{2} \tan \left (f x + e\right )^{2} + 3 \, b^{6} d^{2} \tan \left (f x + e\right )^{2} + 22 \, a^{3} b^{3} c^{2} \tan \left (f x + e\right ) - 2 \, a b^{5} c^{2} \tan \left (f x + e\right ) - 16 \, a^{4} b^{2} c d \tan \left (f x + e\right ) + 36 \, a^{2} b^{4} c d \tan \left (f x + e\right ) + 4 \, b^{6} c d \tan \left (f x + e\right ) - 22 \, a^{3} b^{3} d^{2} \tan \left (f x + e\right ) + 2 \, a b^{5} d^{2} \tan \left (f x + e\right ) + 14 \, a^{4} b^{2} c^{2} + 3 \, a^{2} b^{4} c^{2} + b^{6} c^{2} - 12 \, a^{5} b c d + 14 \, a^{3} b^{3} c d + 2 \, a b^{5} c d + a^{6} d^{2} - 11 \, a^{4} b^{2} d^{2}}{{\left (a^{6} b + 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} + b^{7}\right )} {\left (b \tan \left (f x + e\right ) + a\right )}^{2}}}{2 \, f} \]

input
integrate((c+d*tan(f*x+e))^2/(a+b*tan(f*x+e))^3,x, algorithm="giac")
 
output
1/2*(2*(a^3*c^2 - 3*a*b^2*c^2 + 6*a^2*b*c*d - 2*b^3*c*d - a^3*d^2 + 3*a*b^ 
2*d^2)*(f*x + e)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) - (3*a^2*b*c^2 - b^3* 
c^2 - 2*a^3*c*d + 6*a*b^2*c*d - 3*a^2*b*d^2 + b^3*d^2)*log(tan(f*x + e)^2 
+ 1)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) + 2*(3*a^2*b^2*c^2 - b^4*c^2 - 2* 
a^3*b*c*d + 6*a*b^3*c*d - 3*a^2*b^2*d^2 + b^4*d^2)*log(abs(b*tan(f*x + e) 
+ a))/(a^6*b + 3*a^4*b^3 + 3*a^2*b^5 + b^7) - (9*a^2*b^4*c^2*tan(f*x + e)^ 
2 - 3*b^6*c^2*tan(f*x + e)^2 - 6*a^3*b^3*c*d*tan(f*x + e)^2 + 18*a*b^5*c*d 
*tan(f*x + e)^2 - 9*a^2*b^4*d^2*tan(f*x + e)^2 + 3*b^6*d^2*tan(f*x + e)^2 
+ 22*a^3*b^3*c^2*tan(f*x + e) - 2*a*b^5*c^2*tan(f*x + e) - 16*a^4*b^2*c*d* 
tan(f*x + e) + 36*a^2*b^4*c*d*tan(f*x + e) + 4*b^6*c*d*tan(f*x + e) - 22*a 
^3*b^3*d^2*tan(f*x + e) + 2*a*b^5*d^2*tan(f*x + e) + 14*a^4*b^2*c^2 + 3*a^ 
2*b^4*c^2 + b^6*c^2 - 12*a^5*b*c*d + 14*a^3*b^3*c*d + 2*a*b^5*c*d + a^6*d^ 
2 - 11*a^4*b^2*d^2)/((a^6*b + 3*a^4*b^3 + 3*a^2*b^5 + b^7)*(b*tan(f*x + e) 
 + a)^2))/f
 
3.13.2.9 Mupad [B] (verification not implemented)

Time = 8.76 (sec) , antiderivative size = 367, normalized size of antiderivative = 1.71 \[ \int \frac {(c+d \tan (e+f x))^2}{(a+b \tan (e+f x))^3} \, dx=-\frac {\frac {2\,\mathrm {tan}\left (e+f\,x\right )\,\left (-a^2\,b\,c\,d+a\,b^2\,c^2-a\,b^2\,d^2+b^3\,c\,d\right )}{a^4+2\,a^2\,b^2+b^4}+\frac {a^4\,d^2-6\,a^3\,b\,c\,d+5\,a^2\,b^2\,c^2-3\,a^2\,b^2\,d^2+2\,a\,b^3\,c\,d+b^4\,c^2}{2\,b\,\left (a^4+2\,a^2\,b^2+b^4\right )}}{f\,\left (a^2+2\,a\,b\,\mathrm {tan}\left (e+f\,x\right )+b^2\,{\mathrm {tan}\left (e+f\,x\right )}^2\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (-c^2\,1{}\mathrm {i}+2\,c\,d+d^2\,1{}\mathrm {i}\right )}{2\,f\,\left (-a^3-a^2\,b\,3{}\mathrm {i}+3\,a\,b^2+b^3\,1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (-c^2+c\,d\,2{}\mathrm {i}+d^2\right )}{2\,f\,\left (-a^3\,1{}\mathrm {i}-3\,a^2\,b+a\,b^2\,3{}\mathrm {i}+b^3\right )}-\frac {\ln \left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (2\,c\,d\,a^3+\left (3\,d^2-3\,c^2\right )\,a^2\,b-6\,c\,d\,a\,b^2+\left (c^2-d^2\right )\,b^3\right )}{f\,\left (a^6+3\,a^4\,b^2+3\,a^2\,b^4+b^6\right )} \]

input
int((c + d*tan(e + f*x))^2/(a + b*tan(e + f*x))^3,x)
 
output
- ((2*tan(e + f*x)*(a*b^2*c^2 - a*b^2*d^2 + b^3*c*d - a^2*b*c*d))/(a^4 + b 
^4 + 2*a^2*b^2) + (a^4*d^2 + b^4*c^2 + 5*a^2*b^2*c^2 - 3*a^2*b^2*d^2 + 2*a 
*b^3*c*d - 6*a^3*b*c*d)/(2*b*(a^4 + b^4 + 2*a^2*b^2)))/(f*(a^2 + b^2*tan(e 
 + f*x)^2 + 2*a*b*tan(e + f*x))) - (log(tan(e + f*x) - 1i)*(2*c*d - c^2*1i 
 + d^2*1i))/(2*f*(3*a*b^2 - a^2*b*3i - a^3 + b^3*1i)) - (log(tan(e + f*x) 
+ 1i)*(c*d*2i - c^2 + d^2))/(2*f*(a*b^2*3i - 3*a^2*b - a^3*1i + b^3)) - (l 
og(a + b*tan(e + f*x))*(b^3*(c^2 - d^2) - a^2*b*(3*c^2 - 3*d^2) + 2*a^3*c* 
d - 6*a*b^2*c*d))/(f*(a^6 + b^6 + 3*a^2*b^4 + 3*a^4*b^2))